<?php

/**
 * User form base class.
 *
 * @method User getObject() Returns the current form's model object
 *
 * @package    Coverd
 * @subpackage form
 * @author     Cameron Ross
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUserForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'email'           => new sfWidgetFormInputText(),
      'password'        => new sfWidgetFormInputText(),
      'active'          => new sfWidgetFormInputCheckbox(),
      'activation_hash' => new sfWidgetFormInputText(),
      'account_type'    => new sfWidgetFormInputText(),
      'max_sources'     => new sfWidgetFormInputText(),
      'created_date'    => new sfWidgetFormDateTime(),
      'last_login_date' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'email'           => new sfValidatorString(array('max_length' => 128)),
      'password'        => new sfValidatorString(array('max_length' => 64)),
      'active'          => new sfValidatorBoolean(array('required' => false)),
      'activation_hash' => new sfValidatorString(array('max_length' => 64, 'required' => false)),
      'account_type'    => new sfValidatorString(array('max_length' => 16, 'required' => false)),
      'max_sources'     => new sfValidatorInteger(array('required' => false)),
      'created_date'    => new sfValidatorDateTime(),
      'last_login_date' => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('user[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'User';
  }

}
